package com.aspose.cells;

class zbf extends zbz {
   zbe a;
   private static final com.aspose.cells.b.c.a.za d = new com.aspose.cells.b.c.a.za(new String[]{"#DIV/0!", "#N/A", "#NAME?", "#NULL!", "#NUM!", "#REF!", "#VALUE!"});

   zbf() {
      this.c(158);
      this.b(24);
   }

   void a(zqa var1) throws Exception {
      super.a(var1);
      if (this.a != null) {
         this.a.a(var1);
      }

   }

   void a(FilterColumn var1) throws Exception {
      this.a = null;
      switch(var1.getFilterType()) {
      case 1:
      case 5:
         this.a(new zvo(var1));
         return;
      case 3:
         MultipleFilterCollection var2 = (MultipleFilterCollection)var1.getFilter();
         if (var2.getCount() < 1) {
            this.a(new zvo(var1));
            return;
         } else {
            switch(var2.getCount()) {
            case 0:
               this.a(new zvo(var1));
               return;
            case 1:
               if (!var2.getMatchBlank() && var2.get(0) instanceof String) {
                  this.a(new zvo(var1));
                  return;
               }
               break;
            case 2:
               if (!var2.getMatchBlank() && var2.get(0) instanceof String && var2.get(1) instanceof String) {
                  this.a(new zvo(var1));
                  return;
               }
            }

            this.a = new zbe();
            this.a.a(var1);
         }
      case 0:
      case 2:
      case 4:
      default:
         this.c = new byte[this.d()];
         this.c[0] = (byte)var1.getFieldIndex();
         this.c[2] = 1;
         this.c[5] = 2;
         this.c[12] = 40;
         this.c[13] = 64;
      }
   }

   private void a(zvo var1) throws Exception {
      byte var2 = -1;
      byte var3 = -1;
      String var4 = null;
      String var5 = null;
      if (!var1.d()) {
         if (var1.c != 6 && var1.f != null && var1.f instanceof String) {
            var4 = (String)var1.f;
            if (var4.length() > 0 && var4.charAt(0) == '#') {
               switch(d.a(var4)) {
               case 0:
                  var2 = 7;
                  break;
               case 1:
                  var2 = 42;
                  break;
               case 2:
                  var2 = 29;
                  break;
               case 3:
                  var2 = 0;
                  break;
               case 4:
                  var2 = 36;
                  break;
               case 5:
                  var2 = 23;
                  break;
               case 6:
                  var2 = 15;
                  break;
               default:
                  this.b(this.d() + (short)(2 * var4.length() + 1));
               }
            } else {
               this.b(this.d() + (short)(2 * var4.length() + 1));
            }
         }

         if (var1.d != 6 && var1.e != null && var1.e instanceof String) {
            var5 = (String)var1.e;
            if (var5.length() > 0 && var5.charAt(0) == '#') {
               switch(d.a(var4)) {
               case 0:
                  var2 = 7;
                  break;
               case 1:
                  var2 = 42;
                  break;
               case 2:
                  var2 = 29;
                  break;
               case 3:
                  var2 = 0;
                  break;
               case 4:
                  var2 = 36;
                  break;
               case 5:
                  var2 = 23;
                  break;
               case 6:
                  var2 = 15;
                  break;
               default:
                  this.b(this.d() + (short)(2 * var5.length() + 1));
               }
            } else {
               this.b(this.d() + (short)(2 * var5.length() + 1));
            }
         }
      }

      this.c = new byte[this.d()];
      this.c[0] = (byte)var1.a;
      System.arraycopy(com.aspose.cells.b.a.zc.a(var1.b), 0, this.c, 2, 2);
      if (!var1.d() || var1.f != null) {
         if (var1.f == null) {
            this.c[2] = 4;
            switch(var1.c) {
            case 2:
               this.c[4] = 12;
               this.c[5] = 2;
               break;
            case 4:
               this.c[4] = 14;
               this.c[5] = 5;
               break;
            default:
               this.c[5] = 2;
            }

         } else {
            if (var1.c != 6) {
               this.a(4, var1.c, var1.f, var2);
            }

            if (var1.d != 6) {
               this.a(14, var1.d, var1.e, var3);
            }

            int var6 = 24;
            if (var2 == -1 && var4 != null) {
               this.c[24] = 1;
               System.arraycopy(Encoding.getUnicode().a(var4), 0, this.c, 25, var4.length() * 2);
               var6 += 1 + var4.length() * 2;
            }

            if (var2 == -1 && var5 != null) {
               this.c[var6] = 1;
               System.arraycopy(Encoding.getUnicode().a(var5), 0, this.c, var6 + 1, var5.length() * 2);
               int var10000 = var6 + 1 + var5.length() * 2;
            }

         }
      }
   }

   private void a(int var1, int var2, Object var3, int var4) {
      switch(var2) {
      case 0:
         this.c[var1 + 1] = 3;
         break;
      case 1:
         this.c[var1 + 1] = 1;
         break;
      case 2:
         this.c[var1 + 1] = 2;
         break;
      case 3:
         this.c[var1 + 1] = 4;
         break;
      case 4:
         this.c[var1 + 1] = 5;
         break;
      case 5:
         this.c[var1 + 1] = 6;
      }

      if (var4 != -1) {
         this.c[var1] = 8;
         this.c[var1 + 2] = (byte)var4;
         this.c[var1 + 3] = 1;
      } else if (var3 == null) {
         switch(var2) {
         case 2:
            this.c[var1] = 12;
            break;
         case 4:
            this.c[var1] = 14;
            break;
         default:
            this.c[var1] = 6;
            this.c[var1 + 6] = 0;
         }
      } else {
         switch(zamo.a(var3.getClass())) {
         case 3:
            this.c[var1] = 8;
            this.c[var1 + 2] = (byte)((Boolean)var3 ? 1 : 0);
            break;
         case 9:
            this.c[var1] = 4;
            System.arraycopy(com.aspose.cells.b.a.zc.a((double)(Integer)var3), 0, this.c, var1 + 2, 8);
            break;
         case 14:
            this.c[var1] = 4;
            System.arraycopy(com.aspose.cells.b.a.zc.a((Double)var3), 0, this.c, var1 + 2, 8);
            break;
         case 18:
            this.c[var1] = 6;
            this.c[var1 + 6] = (byte)((String)var3).length();
         }
      }

   }
}
